extends Control
@onready var resume: Button = $V/Actions/H/Resume

func _ready() -> void:
	hide()
	SoundManager.setup_ui_sounds(self)

func show_pause() -> void:
	show()
	resume.grab_focus()

func _on_resume_pressed() -> void:
	hide()

func _on_quit_pressed() -> void:
	hide()
	Game.back_to_title()

func _on_visibility_changed() -> void:
	_pause_game()
	
func _pause_game():
	get_tree().paused = visible

func _input(event:InputEvent) -> void:
	if Input.is_action_just_pressed("pause"):
		hide()
		get_window().set_input_as_handled()
